<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><PHP>echo getSysTitle();</PHP></title>
<link href="__CSS__/table.css" rel="stylesheet" type="text/css" />
<script src="__JS__/jquery-1.6.2.min.js"></script>
<link rel="stylesheet" href="__JS__/validfrom/css/style.css" type="text/css" media="all" />
<link href="__JS__/validfrom/css/demo.css" type="text/css" rel="stylesheet" />
<script src="__JS__/popup/popup.js"></script>
<script src="__JS__/popup/user.js"></script>
<script type="text/javascript" src="__JS__/lightbox/js/jquery.lightbox-0.4.js"></script>
<link rel="stylesheet" type="text/css" href="__JS__/lightbox/css/jquery.lightbox-0.4.css" media="screen" />
<link href="__CSS__/main.css" rel="stylesheet" type="text/css" />
<script src="__JS__/jquery.form.js"></script>
<script src="__JS__/qtip/js/jquery.qtip.min.js"></script>
<link href="__JS__/qtip/css/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script>
$(document).ready(function(){
	
	
	//完成 
	$("#finish").bind('click',function(){
		savedata(40);
	});
	
	//中断 
	$("#break").bind('click',function(){
		breakorder();
	});
	 $('#portfolio a').lightBox();
	 $("#oprint").click(function(){
		 window.open ('?g=Home&m=Order&a=out&O_ID={$data.O_ID}','newwindow','height=550,width=750,top=50,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
	 });
	 //预约时间
	 $("#yuyuetime").click(function(){
		 var url="?g=Home&m=Order&a=yytime&o_id={$data.O_ID}";
		pDialog('',url,550,250);
	 });
	 
	 
	 $('#roleForm').submit(function(){
			$(this).ajaxSubmit(options); 
			return false;
		});
		//$('#roleForm').ajaxSubmit(options); 
		var options={
				 beforeSubmit:  showRequest,  
				 success:       showResponse  
		};
		
		$("#saveok").click(function(){
			$("#submit").click();
		});
		
	$("#zhipaiworker").click(function(){
		//todo:
		var url="?g=Home&m=Member&a=wlistd&o_id={$data.O_ID}";
		pDialog("安装人员信息",url,600,450);
	});
	
	$("#backOrder").click(function(){
		var url="?g=Home&m=Order&a=backorder&o_id={$data.O_ID}";
		pDialog("退回",url,700,300);
	});
});

function showRequest(formData, jqForm, options) { 
	if($("#O_ST_MEMO_EXT").val()==""){
		
		userTip('O_ST_MEMO_EXT','请输入备注内容');
		return false;
	}
	return true;
	
}
function showResponse(rs, statusText, xhr, $form)  { 

	if(rs=='y'){
		$("#errTitle").html("备注保存成功");
		//userTip('O_CS_MEMO_EXT','备注保存成功');
		
	}else{
		$("#errTitle").html("备注保存失败");
		//userTip('O_CS_MEMO_EXT','备注保存失败');
	}
}
function breakorder(){
	var url="?g=Home&m=Order&a=obreak&o_id={$data.O_ID}";
	pDialog('中断',url,550,300);
}
function savedata(state){
	var url="?g=Home&m=Order&a=finish&o_id={$data.O_ID}";
	pDialog('安装完成',url,580,480);
	
	/*if(window.confirm("确认操作？")){
		var url="o_id={$data.O_ID}&state="+state;
		$.ajax({
			   type: "POST",
			   url: "?g=Home&m=Order&a=saveState",
			   data: url,
			   dataType:'text',
			   success: function(msg){
				 if(msg=="y"){
					 alert('操作成功');
					 
				 }else{
					 alert('操作失败');
				 }
			   }
		});
	}
	*/
}
function openDialog(url,title){
	if(!title){
		title='服务队信息';
	}
	pDialog(title,url,600,450);
}
function dialogClose(){
	pclose();
}
function showImage(id){
	var url="?g=Home&m=Order&a=showImage&o_id="+id;
	pDialog('安装卡',url,600,500);
}
function userTip(sob,ct){
	 // 阴影+圆角
     $("#"+sob).qtip({
       position: {
         my: 'bottom left',
         at: 'top center'
       },
       style: {
         classes: 'ui-tooltip-red ui-tooltip-shadow ui-tooltip-rounded'
       },
       show: {
			event: false, // Don't specify a show event...
			ready: true // ... but show the tooltip when ready
		},
       content: ct
     });
}
</script>
<style>
a {color:#FFFFFF}
.cFieldset{margin-top:5px;}
.content{
	margin-left:100px;
    height:480px;
}
#crinfo1{
	height:30px;
}
#roleForm table th td{height:30px;line-height:30px;}

.content1{
	background-color:#F9F9F9;
	width:760px;
	_width:760px;
	height:530px;
	margin:0px;
	/*float:left;*/
}
#chulixinxi td{height:20px;}
</style>
</head>
<body>
<div id="container">
<if condition="$xy eq 'n'">
<div class="content" style="height:850px">
<else />
<div class="content" style="height:1360px">
</if>

	<form class="registerform"  id="roleForm" method="post">
		<fieldset>
    		<legend >服务单详情</legend>
    		
    			<fieldset class="cFieldset" >
	    			
	    			<table width="100%" cellspacing="0" cellpadding="0" border="0">
		                <tr>
		                    <th width="12%">服务类型</th>
		                    <td width="88%">
		                    	{$data.O_TYPE|default='无'}
		                    	
		                    	<span style="padding-left:80px">
		                    		<span style="color:#FF7625;font-weight:bold;">安装方式</span>
		                    		<span style="padding-left:10px">{$data.O_S_TYPE|getDictValueByKey='INSTALL_MODE',###}</span>
		                    	</span>
		                    </td>
		                </tr>
		                 <tr>
		                    <th >产品信息</label></th>
		                    <td style="">
		                    	{$data.O_PRODUCT|default='无'}，数量 {$data.P_COUNT|default='无'}， {$data.P_BUY_TIME} 购于 {$data.P_CHANNEL|default='无'}，订单号 {$data.SO_ID|default='无'}<br />
		                    	条形码 {$data.P_BAR_CODE|default='无'}，安装卡 
		                    	<if condition="$data.P_INSTALL_CARD neq ''">
		                    	<span id="portfolio"><a href="{$data.P_INSTALL_CARD}" onclick1="showImage('{$data.O_ID}');return false;">查看大图</a></span>
		                    	<else />
		                    	无
		                    	</if>
		                    </td>
		                </tr>
		                 <tr>
		                    <th >服务地址</label></th>
		                    <td style="">
		                    	{$data.CU_NAME|default='无'}，{$data.O_MOBILE|default='无'}
		                    	<if condition="$data.O_PHONE neq ''">，{$data.O_PHONE|default='无'}</if>，{$data.O_AREA}
		                    	<if condition="$data.O_POSTCODE neq ''">，{$data.O_POSTCODE|default='无'}</if>
		                    </td>
		                </tr>
		                 <tr>
		                    <th >备注说明</label></th>
		                    <td style="">
		                    	{$data.O_MEMO|default='无'}
		                    </td>
		                </tr>
	            	</table>
            	</fieldset>
            	<php>
                  if(ExSession::getSession()->getRoleShortname()=="CR"){
                </php>
                  <fieldset class="cFieldset" id="crinfo">
            		<table width="100%" cellspacing="0" cellpadding="0" border="0">
		                <tr>
		                    <th width="12%">服务队信息</th>
		                    <td width="88%">
		                    	<table width="100%">
		                    		<tr>
		                    			 	<td width="30%">服务队：{$data.ST_NAME|default='无'}</td>
						                    
						                    <td width="70%" colspan="2">服务人员：{$data.SRV_NAME|default='无'}，{$data.ST_MOBILE|default=''}，{$data.ST_PHONE|default=''}</td>
						                    
		                    		</tr>
		                    	</table>
		                    </td>
		                   
		                </tr>
	            	</table>
            	</fieldset>
                <php>
                  }else{
                </php>
                  <fieldset class="cFieldset" id="crinfo">
            		<table width="100%" cellspacing="0" cellpadding="0" border="0">
		                <tr>
		                    <th width="12%">客户信息</th>
		                    <td width="88%">
		                    	<table width="60%">
		                    		<tr>
		                    			 	<td width="10%">会员：</td>
						                    <td width="20%">
						                    	{$data.CU_ID_Name|default='无'}
						                    </td>
						                    <td width="10%">客户名：</td>
						                    <td width="20%">
						                    	{$data.CU_NAME|default='无'}
						                    </td>
		                    		</tr>
		                    	</table>
		                    </td>
		                   
		                </tr>
	            	</table>
            	</fieldset>
                <php>
                  }
                </php>	
            	
            	
            	<fieldset class="cFieldset">
	    			
	    			<table width="100%" cellspacing="0" cellpadding="0" border="0" id="chulixinxi">
		                <tr>
		                    <th width="12%">处理信息</th>
		                    <td width="88%">
		                    	<table width="100%">
		                    		<tr>
		                    			<td width="35%">
		                    			编　　号：{$data.O_NO|default='无'}
		                    			</td>
		                    			<td width="35%">
		                    			提交时间：{$data.CREATED_AT|DateFormat="Y-m-d H:i",###|default='无'}
		                    			</td>
		                    			<td width="30%">
		                    			状　　态：{$data.O_STATE_NAME|default='无'}
		                    			</td>
		                    			 	
		                    		</tr>
		                    		<tr>
		                    			<td>
		                    			要求时间：{$data.O_REQ_TIME|default='无'}
		                    			</td>
		                    				<td >
		                    			预约时间：{$data.O_SRV_APPOINT_TIME|DateFormat="Y-m-d H:i",###|default='无'}
		                    			</td>
		                    			<td>
		                    			服务时间：{$data.O_SRV_TIME|default='无'}
		                    			</td>
		                    			
		                    		</tr>
		                    		<tr>
		                    		 <php>
						                    if(ExSession::getSession()->getRoleShortname()=="CR"){
						                    	</php>
						                    	<td ></td>
							                  
							                    <php>
						                    }else{
						                    	</php>
						                    	 	<td >结算状态：{$data.O_F_STATE|default='无'}</td>
								                    
						                    	<php>
						                    }
						                    </php>	
						                   
		                    		
		                    			<td>收　　费：{$data.O_COST|getNumberValue=###,'元'}</td>
		                    			<td>安装人员：{$data.O_INSTALL_USER|default='无'}</td> 	
		                    		</tr>
		                    		<tr>
	                    			 	<td >安装费：{$data.O_INST_FEE|getFormatMoney=###}</td>
					                   
					                    <td >差旅费：{$data.O_TRAVEL_EXPENSE|getFormatMoney=###}</td>
					                     <td >材料费：{$data.O_MATERIAL_FEE|getFormatMoney=###}</td>
		                    		</tr>
		                    		<tr>
	                    			 	<td colspan="3">其他费用：{$data.O_OTHER_COST|getFormatMoney=###}</td>
					                   
		                    		</tr>
		                    		<tr>
		                    			<td>
		                    			材料明细：{$data.O_STUFF_DETAILS|default='无'}
		                    			</td>
		                    			<td></td>
		                    			<td></td>
		                    			
		                    		</tr>
		                    	</table>
		                    </td>
		                   
		                </tr>
	            	</table>
            	</fieldset>
            	<fieldset class="cFieldset">
	    			
	    			<table width="100%" id="chulixinxi">
		                <tr>
		                    <th style="" width="15%">安装信息</th>
		                    <td style="" width="85%">
		                    	<table width="100%">
		                    		
		                    		<tr>
	                    			 	
					                    <td >是否安装漏电开关：{$data.O_INSTOPT_LOUDIANKAIGUAN|getRadioValue=###}</td>
					                    
					                     <td >是否有良好接地线：{$data.O_INSTOPT_LIANGHAOJIEDI|getRadioValue=###}</td>
					                   
					                    <td >是否告知用户安装事项：{$data.O_INSTOPT_GAOZHISHIXIANG|getRadioValue=###}</td>
					                    
		                    		</tr>
		                    		<tr>
	                    			 	
					                    <td >是否安装在浴室外：{$data.O_INSTOPT_YUSHIWAI|getRadioValue=###}</td>
					                     <td >是否安装排烟管：{$data.O_INSTOPT_PAIYANGUAN|getRadioValue=###}</td>
					                     <td >是否安装在空气流通的地方：{$data.O_INSTOPT_KONGQILIUTONG|getRadioValue=###}</td>
		                    		</tr>
		                    		
		                    	
		                    	</table>
		                    </td>
		                   
		                </tr>
	            	</table>
            	</fieldset>
            	<fieldset class="cFieldset">
            		
            		<table width="100%" cellspacing="0" cellpadding="0" border="0">
            			<tr>
            				 <th width="12%">内部备注<br />
            				 <font  style="font-size:11px;color:#C7C7C7"></div>（客户不可见）</th>
            				 <td>
            				 	
            				 	<textarea rows=3 cols=60 id="O_ST_MEMO_EXT" name="O_ST_MEMO_EXT" style="width:500px; height:42px;">{$data.O_ST_MEMO_EXT}</textarea>
            				 	<span id="saveok" style="color:#086DC9;cursor:pointer">[保存]</span>&nbsp;&nbsp;<span id="errTitle" style="color:#CFC7C7"></span>
            				 	 <span id="viewTitle" style="color:#FE0914;"></span>
            				 </td>
            				 <td vlign="center" align="left">
            				 <div style="display:none"><input type="submit" name="submit" id="submit"  value="保存" /></div>
            				<input type="hidden" id="O_ID" name="O_ID" value="{$o_id}"></input>
            				<input type="hidden"  name="op" value="1"></input>
            				 </td>
            			</tr>
            		</table>
            		
            	</fieldset>
            	<fieldset class="cFieldset">
            		<table width="100%" cellspacing="0" cellpadding="0" border="0">
            			<tr>
            				 <th width="12%">客服备注</th>
            				 <td>
            				 	{$data.O_CS_MEMO_EXT|default='无'}
            				 </td>
            			</tr>
            		</table>
            	</fieldset>
            		<php>
            		if(ExSession::getSession()->getRoleShortname()=="SRVTEAM" || ExSession::getSession()->getRoleShortname()=="WORKER"){
            		</php>
            		<table width="100%" align="center" cellspacing="0" cellpadding="0" border="0">
		                <tr>
		                    <td align="center" style="text-align:center">
		                    	<if condition="($data.O_STATE eq 20) OR ($data.O_STATE eq 30)">
		                    	<input type="button" id="yuyuetime" value="预约时间" style="height:30px;"/>
		                    	<input type="button" id="finish" value="安装完成" style="height:30px;"/>
								
								<input type="button" id="break" value="中断" style="height:30px;"/>
								<php>
			            		if(ExSession::getSession()->getRoleShortname()=="SRVTEAM"){
			            		</php>
								<input type="button" id="backOrder" value="退回上级" style="height:30px;"/>
								<php>
			            		}
			            		</php>
								</if>
								<input type="button" id="oprint" value="打印" style="height:30px;"/>
								
								<php>
								if(ExSession::getSession()->getRoleShortname()=="SRVTEAM"){
								</php>
								<input type="button" id="zhipaiworker" value="指派安装人员" style="height:30px;"/>
								<php>
								}
								</php>
								
								
								
		                    </td>
		                </tr>
	            	</table>
            	
            		<php>
            		}
            		</php>
	    			
		</fieldset>
	</form>
 	<if condition="$xy neq 'n'">
 	<div style="background-color:#ffffff">
   	 <fieldset  class="cFieldset">
   		<legend >地图</legend>
  			
  			<table  align="center" width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
	     	<tr>
	     		<td>
	     			<div id="containerMap" style="height:450px;width:100%"></div>
	     		</td>
	     	</tr>
   		</table>
    </fieldset>
   <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=8f390a23b983f25007b2b12e105a0489"></script>
	<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
		<script>
		// 百度地图API功能
		//谷歌坐标
		var x = parseFloat('{$xy.x}');
		var y = parseFloat('{$xy.y}');
		var ggPoint = new BMap.Point(x,y);
	
		//地图初始化
		var bm = new BMap.Map("containerMap");
		bm.centerAndZoom(ggPoint, 15);
		bm.addControl(new BMap.NavigationControl());
		bm.addControl(new BMap.OverviewMapControl());  
	
		//添加谷歌marker和label
		/*var markergg = new BMap.Marker(ggPoint);
		bm.addOverlay(markergg); //添加谷歌marker
		var labelgg = new BMap.Label("我是谷歌标注哦",{offset:new BMap.Size(20,-10)});
		markergg.setLabel(labelgg); //添加谷歌label
		*/
		//坐标转换完之后的回调函数
		translateCallback = function (point){
		    var marker = new BMap.Marker(point);
		    bm.addOverlay(marker);
		   // var label = new BMap.Label("这里",{offset:new BMap.Size(20,-10)});
		    marker.setLabel(label); //添加百度label
		    bm.setCenter(point);
		    //alert(point.lng + "," + point.lat);
		}
	
		setTimeout(function(){
		    BMap.Convertor.translate(ggPoint,2,translateCallback);     //GCJ-02坐标转成百度坐标
		}, 2000);
	</script>	
    </div>
   </if>
</div>
</div>
</body>

